﻿/********************************************************************************
** @ Date:2024/04/23
** @ Author: AoZhiQiang
** @ Description: 机器人信息交互线程基类
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CInfoExchangeForRob_H
#define CInfoExchangeForRob_H
#include <QObject>
#include <QMultiMap>
#include "CInfoExchangeBase.h"


//命令触发类型
enum ETriggerMode
{
	enSingleTrigger,               //单点触发
	enSustainTrigger,              //持续触发
	enOtherTrigger                 //其他触发
};
class Robot;
class CInfoExchangeForRob  : public CInfoExchangeBase
{
	Q_OBJECT

public:
	CInfoExchangeForRob(QObject *parent = nullptr);
	~CInfoExchangeForRob();

protected:
	void handleCtrProt(SReqDataParam stParam) override;		                                       //处理控制协议
	void handleMsgProt(SReqDataParam stParam) override;		                                       //处理报文推送协议
	void handleMsgDevice(SReqDataParam stParam) override;		                                   //处理报文推送协议
	void handleMsgScene(SReqDataParam stParam) override;										   //处理场景报文推送协议

private:
	void initTriggerModeCode();                                                                    //初始化触发模式对应的指令
	void handleSingleTrigger(SReqDataParam stReqParam, Robot* pDev, SRspDataParam& stRspParam);    //处理单点触发的代码
	void handleSustainTrigger(SReqDataParam stReqParam, Robot* pDev, SRspDataParam& stRspParam);   //处理长按触发的代码
	void handleOtherTrigger(SReqDataParam stReqParam, Robot* pDev, SRspDataParam& stRspParam);     //处理其他触发的代码
	bool getTriggerMode(SReqDataParam stParam, int& nTriggerType);                                 //获取触发类型
	bool judgeFollow(SReqDataParam stParam, SRspDataParam& stRspParam);                            //判断是否可以关注
	bool judgeCtr(SReqDataParam stParam, SRspDataParam& stRspParam);                               //判断是否可以控制

private:
	QMultiMap<ETriggerMode, int> m_mapTriggerModeCode;                          //触发模式对应的指令
	QMap<int, QString> m_mapItemType;//巡检项类型
	QMap<int, QString> m_mapUnit;//不同巡检项对应不同的单位
};

#endif 